package config

type Node_info struct { //一个节点的数据信息
	Node_name    string   //所属节点名称
	Node_url     string   //所属节点连接url(ip:port)
	Node_db_type string   //所属节点数据类型
	User         string   //用户名，root
	Password     string   //密码 123456
	Database     []string //数据库名Site1 Site2
	State        bool     //状态 false不在线，true在线
}

var (
	// 节点信息
	Node1 = Node_info{ //第一个节点的信息
		Node_name:    "Site1",
		Node_url:     "127.0.0.1:3306",
		Node_db_type: "mysql",
		User:         "root",
		Password:     "123456",
		Database:     []string{"Site1"},
		State:        false,
	}
	Node2 = Node_info{ //第二个节点的信息
		Node_name:    "Site2",
		Node_url:     "127.0.0.1:3307",
		Node_db_type: "mysql",
		User:         "root",
		Password:     "123456",
		Database:     []string{"Site2"},
		State:        false,
	}
	Node3 = Node_info{ //第三个节点的信息
		Node_name:    "Site3",
		Node_url:     "127.0.0.1:3308",
		Node_db_type: "mysql",
		User:         "root",
		Password:     "123456",
		Database:     []string{"Site3"},
		State:        false,
	}
	Node4 = Node_info{ //第四个节点的信息
		Node_name:    "Site4",
		Node_url:     "127.0.0.1:3309",
		Node_db_type: "mysql",
		User:         "root",
		Password:     "123456",
		Database:     []string{"Site4"},
		State:        false,
	}
	node_list = []Node_info{Node1, Node2, Node3, Node4}
)

func GetNode(s string) Node_info {
	for _, v := range node_list {
		if v.Node_name == s {
			return v
		}
	}
	return Node_info{}
}
